<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>substr</title>
</head>
<body>
    <script>
        var x='javascript,是最好的语言！'
 
        alert( x .substr(0 ,10));
        alert( x .substring(0 ,10));
        alert( x .slice(0 ,10));
        alert(x.indexOf('a'));
        alert(x.toUpperCase())
    </script>
</body>
</html>